﻿#include <QApplication>
#include <qfiledialog.h>

#include "mainwindow.h"
#include "videohandler.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
//    MainWindow w;
//    w.show();

    QString fileName = QFileDialog::getOpenFileName();
    if (fileName == QString(""))
        return 1;
    QFile file(fileName);
    file.open(QFile::ReadOnly);

    QXmlSimpleReader xmlSimpleReader;
    VideoHandle videoHandle;
    xmlSimpleReader.setContentHandler(&videoHandle);
    QXmlInputSource xmlInputSource(&file);

    if (xmlSimpleReader.parse(&xmlInputSource)) {
        qDebug() << videoHandle.m_actor.toStdString().c_str()
                 << videoHandle.m_pageURL.toStdString().c_str()
                 << videoHandle.m_tags.toStdString().c_str()
                 << videoHandle.m_videoName.toStdString().c_str()
                 << videoHandle.m_summary.toStdString().c_str();
    }else {
        xmlSimpleReader.errorHandler();
        videoHandle.errorString();

    }


    return a.exec();
}
